home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
UTIL
/
Alpha 6.5.sit
/
Tcl
/
SystemCode
/
menus.tcl
< prev
next >
Wrap
Text File
|
1996-08-16
|
10KB
|
551 lines
# My menus.
if !$alphaLite {
menu -n File -p fileMenuProc {
"/Nnew"
"/Oopenノ"
{menu -n recent {}}
"<S/Wclose"
"<S<I<O/WcloseAll"
"(-"
"<S/Ssave"
"<S<I<O/SsaveAll"
"<SsaveACopyAsノ"
"<SsaveAsノ"
"<E<SrevertToBackup"
"<Srevert"
"(-"
"<S/Y<Oshell"
"<S/Y<U<Ocalculator"
"<S/Y<B<OtoolserverShell"
"(-"
"pageSetupノ"
{menu -n print {}}
"(-"
"/Qquit"
}
menu -n Edit {
"/Zundo"
"/Z<I<Oredo"
"/Lload"
"(-"
"/X<Scut"
"/X<S<I<Ocut&Append"
"/C<Scopy"
"/C<S<I<Ocopy&Append"
"/V<Spaste"
"/V<S<I<OpastePop"
"/A<SselectAll"
"/A<S<I<OselectParagraph"
"clear"
"(-"
{menu -n emacs {}}
"/`<Stwiddle"
"/`<S<I<OtwiddleWords"
"(-"
{/[<SshiftLeft}
{/[<S<I<OshiftLeftSpace}
{/]<SshiftRight}
{/]<S<I<OshiftRightSpace}
"/Bbalance"
}
menu -n Text {
"/I<SfillParagraph"
"/I<S<O<IwrapParagraph"
"/I<S<O<I<UsentenceParagraph"
"/U<S<OfillRegion"
"/U<S<I<OwrapRegion"
"/U<S<O<I<UsentenceRegion"
"<E<SparagraphToLine"
"<SlineToParagraph"
"(-"
"<SreverseSort"
"<SsortLines"
"/L<I<OspellcheckWindow"
"(-"
"zapInvisibles"
"<SspacesToTabs"
"<StabsToSpaces"
"<S<EindentRegion"
"<SindentLine"
"<E<SdowncaseRegion"
"<SupcaseRegion"
"(-"
{menu -n Strings {
"<SremovePrefix"
"<SinsertPrefix"
"<S<EremoveSuffix"
"<SinsertSuffix"
"setPrefix"
"setSuffix"
}}
"/D<ScommentLine"
"/D<S<I<OuncommentLine"
"<SuncommentBox"
"<ScommentBox"
"<S<EuncommentParagraph"
"<ScommentParagraph"
"(-"
"/=markHilite"
{menu -n namedMarks -p namedMarkProc {
"/K<Osetノ"
"/K<I<Ogotoノ"
"removeノ"
"(-"
"sort"
"sortByPosition"}}
{menu -n unnamedMarks -p unnamedMarkproc {
"setノ"
"exchangePointAndMark"}}
}
menu -n "Utils" {
{menu -n fileUtils {
"insertPathNameノ"
"insertFileノ"
"fileRemoveノ"
"fileInfoノ"
"wordCount"
"textToAlpha"}}
{menu -m -n compare -p compareProc {
"Windows"
"Filesノ"
"Directoriesノ"}}
{menu -n asciiEtc {
"quoteChar"
"(-"
"keyCode"
"keyAscii"
"getAscii"
"insertAscii"}}
{menu -n KbdMacros {
"/qstartKeyboardMacro"
"/rendKeyboardMacro"
"/sexecuteKeyboardMacro"
"dumpMacro"}}
"(-"
"sendUrl"
{menu -m -n switchTo -p switchProc {}}
"(-"
"/M<I<OmatchingLines"
"gotoMatch"
"nextMatch"
"(-"
"/jcmdDoubleClick"
}
menu -n Config {
{menu -n "Current Mode" -p modeOptions {
"menusノ"
"flagsノ"
"editPrefs"
"loadPrefsノ"
"describeMode"
"(-"
"/m<Uchangeノ"
}}
{menu -n Global -p globalOptions {
"menusノ"
"flagsノ"
"editPrefs"
"listBindings"
"listFunctions"}}
"suffixMappingsノ"
"/kdescribeBinding"
"viewSavedSettingノ"
"removeSavedSettingノ"
"(-"
{menu -n appPaths {}}
{menu -m -n install -p installProc {
"Electric Alias"
"(-"
"LaTeX 2e"
"LaTeX 2.09"}}
"deconstructノ"
"(-"
"/lsetFontsTabsノ"
{menu -n redefineColors -p colorProc {
foreground
background
"(-"
blue
cyan
green
magenta
red
white
yellow
"(-"
color_9
color_10
color_11
color_12
color_13
color_14
color_15}}
}
menu -n $winMenu -p menuWin {
"//<Szoom"
"//<S<I<OsinglePage"
"<S/;chooseAWindow"
"/I<Biconify"
{menu -n arrange -p winTileProc {
"/Jvertically^1"
"/J<O<Ihorizontally^2"
"/J<B<OunequalVert^6"
"/J<B<I<OunequalHor^5"
"(-"
{menu -n other {
{bufferOtherWindow}
{iconify}
{nextWin}
{nextWindow}
{prevWindow}
{shrinkFull}
{shrinkHigh}
{shrinkLeft}
{shrinkLow}
{shrinkRight}
{singlePage}
{swapWithNext}
{zoom}
}}}}
"(-"
"/msplitWindow"
"/otoggleScrollbar"
"(-"
}
} else {
menu -n File -p fileMenuProc {
"/Nnew"
"/Oopenノ"
{menu -n recent {}}
"<S/Wclose"
"<S<I<O/WcloseAll"
"(-"
"<S/Ssave"
"<S<I<O/SsaveAll"
"<SsaveAsノ"
"<E<SrevertToBackup"
"<Srevert"
"(-"
"pageSetupノ"
"/Pprintノ"
"(-"
"/Qquit"
}
menu -n Edit {
"/Zundo"
"/Z<I<Oredo"
{menu -n emacs {}}
"(-"
"/X<Scut"
"/X<S<I<Ocut&Append"
"/C<Scopy"
"/C<S<I<Ocopy&Append"
"/V<Spaste"
"/V<S<I<OpastePop"
"/A<SselectAll"
"/A<S<I<OselectParagraph"
"clear"
"(-"
"/=selectLast"
"/`<Stwiddle"
"/`<S<I<OtwiddleWords"
}
menu -n Text {
"/I<SfillParagraph"
"/I<S<O<IwrapParagraph"
"/I<S<O<U<I<BsentenceParagraph"
"/U<S<OfillRegion"
"/U<S<I<OwrapRegion"
"/U<S<O<U<I<BsentenceRegion"
"<E<SupcaseRegion"
"<SdowncaseRegion"
"(-"
"<SreverseSort"
"<SsortLines"
"/L<I<OspellcheckWindow"
"zapInvisibles"
"<SspacesToTabs"
"<StabsToSpaces"
"(-"
"/D<ScommentLine"
"/D<S<I<OuncommentLine"
"<SuncommentBox"
"<ScommentBox"
"<S<EuncommentParagraph"
"<ScommentParagraph"
"(-"
"textToAlpha"
}
menu -n Config {
{menu -n "Current Mode" -p modeOptions {
"menusノ"
"flagsノ"
"editPrefs"
"loadPrefsノ"
"describeMode"
"(-"
"/m<Uchangeノ"
}}
{menu -n Global -p globalOptions {
"menusノ"
"flagsノ"
"editPrefs"
"listBindings"
"listFunctions"}}
"suffixMappingsノ"
"(-"
"/kdescribeBinding"
"viewSavedSettingノ"
"removeSavedSettingノ"
"(-"
"/lsetFontsTabsノ"
}
menu -n $winMenu -p menuWin {
"//<Szoom"
"//<S<I<OsinglePage"
"<S/;chooseAWindow"
"/I<Biconify"
{menu -n arrange -p winTileProc {
"/Jvertically^1"
"/J<O<Ihorizontally^2"
"/J<B<OunequalVert^6"
"/J<B<I<OunequalHor^5"
"(-"
}}
"(-"
"/isetFontsTabsノ"
"/msplitWindow"
"/otoggleScrollbar"
"(-"
}
}
proc fileMenuProc {menu item} {
if {$item == "open"} {
findFile
} elseif {$item == "close"} {
killWindow
} else {
$item
}
}
menu -n Search {
"/F<Sfindノ"
"/F<S<I<OsearchStart"
"/G<SfindAgain"
"/G<S<I<OfindAgainBackward"
"/MfindInNextFile"
"/E<SenterSearchString"
"/E<S<I<OenterReplaceString"
"(-"
"/S<BquickFind"
"/R<BreverseQuickFind"
"(-"
"/Rreplace"
"/Hreplace&FindAgain"
"<S/R<O<IreplaceAll"
"<S/R<O<I<BreplaceInFileset"
"(-"
"/,<BpushPosition"
"/.<BpopPosition"
"/G<IgotoLine"
}
proc pushPosition {} {pushMark}
proc popPosition {} {popMark}
# {menu -n NamedClipboards -p namedClipMenuProc {"copyノ" "cutノ" "pasteノ"}}
# {menu -n registers { pointToRegister jumpToRegister }}
proc namedMarkProc {menu item} {
switch $item {
"markFile" {markFile; message "File marked."}
"set" {setNamedMark}
"goto" {gotoFileMark}
"remove" {removeNamedMark}
"sort" {sortMarksFile}
"sortByPosition" {orderMarks}
}
}
proc unnamedMarkproc {menu item} {
switch $item {
"set" {setMark}
"exchangePointAndMark" {exchangePointAndMark}
"hilite" {markHilite}
}
}
proc installProc {menu item} {
switch $item {
"Electric Alias" {loadElectricAlias}
"LaTeX 2.09" {loadLaTeX}
"LaTeX 2e" {loadLaTeX}
}
}
proc compareProc {menu item} {
catch {compare$item} msg
message $msg
}
proc namedClipMenuProc {menu item} {
switch $item {
"copy" "copyNamedClipboard"
"cut" "cutNamedClipboard"
"paste" "pasteNamedClipboard"
}
}
proc colorProc {menu item} {
global colorInds modifiedArrVars
if {[info exists colorInds($item)]} {
set color [eval [list colorTriple "New ¥"$item¥":"] $colorInds($item)]
} else {
switch $item {
foreground { set inds "0 0 0" }
background { set inds "65535 65535 65535" }
blue { set inds "0 0 65535" }
cyan { set inds "61404 11464 34250" }
green { set inds "1151 33551 8297" }
magenta { set inds "44790 1591 51333" }
red { set inds "65535 0 0" }
white { set inds "65535 65535 65535" }
yellow { set inds "61834 64156 12512" }
default { set inds "65535 65535 65535" }
}
set color [eval [list colorTriple "New ¥"$item¥":"] $inds]
}
eval setRGB $item $color
set colorInds($item) $color
lappend modifiedArrVars colorInds
}
#===============================================================================
proc helpMenu {item} {
global HOME
if {$item == "Alpha Manual"} {
edit -r "$HOME:Help:Manual"
} else {
edit -r "$HOME:Help:$item"
}
}
if {![catch {glob "$HOME:Help:*"} files]} {
set men { "Alpha Manual" "Alpha Commands" "Tcl Commands" "(-" "Quick Start" "Readme" "Changes" "(-" }
foreach f [lsort -ignore $files] {
set f [file tail $f]
if {[lsearch $men $f] < 0} {
lappend men $f
}
}
foreach f $men {
addHelpMenu $f
}
unset men
}
#===============================================================================
proc buildSwitches {} {
global switchApps
menu -m -n switchTo -p switchProc {"<O<I/NNowノ" "Addノ" "Removeノ" "(-"}
if {[info exists switchApps] && [llength $switchApps]} {
foreach app $switchApps {
lappend names [file tail $app]
}
foreach name [lsort -ignore $names] {
addMenuItem -m -l "blah" switchTo $name
}
}
}
proc switchProc {menu name} {
global switchTo switchApps
if {$name == "Add"} {
set fname [getfile "Pick an app:"]
lappend switchApps $fname
addDef switchApps $switchApps
buildSwitches
} elseif {$name == "Remove"} {
foreach app $switchApps {
lappend apps [file tail $app]
}
set name [listpick -p "Remove which app?" $apps]
if {[set ind [lsearch $switchApps "*$name"]] >= 0} {
set switchApps [lreplace $switchApps $ind $ind]
addDef switchApps $switchApps
buildSwitches
}
} elseif {$name == "Now"} {
switchApp
} else {
if {[set ind [lsearch $switchApps "*$name"]] >= 0} {
if {[catch {switchTo $name}]} {
launch -f [lindex $switchApps $ind]
}
}
}
}
proc winTileProc {menu item} {
win$item
}
# "tiled^3"
# "overlay^4"
# We may be reloading, so add whatever windows we have
if {[info exists winNameToNum]} {
set nms [array names winNameToNum]
foreach name $nms {
regexp {[^:]*$} $name item
set num $winNameToNum($name)
if {$num < 10} {
addMenuItem -m $winMenu /$num$item
} else {
addMenuItem -m $winMenu $item
}
}
}
insertMenu "File"
insertMenu "Edit"
insertMenu "Text"
insertMenu "Search"
catch {insertMenu "Utils"}
#enableMenuItem NamedClipboards paste off
insertMenu "Config"
insertMenu $winMenu